<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{$Think.config.site.title} - 更新代理商信息</title>
    <meta name="keywords" content="{$Think.config.site.keywords}">
    <meta name="description" content="{$Think.config.site.description}">
    <link rel="shortcut icon" href="favicon.ico"> <link href="{$Think.config.site.resource_url}css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/animate.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/plugins/chosen/chosen.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/style.css?v=4.1.0" rel="stylesheet">
</head>
<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight"> 
      <div class="row">
      <form method="post" class="form-horizontal" action="" id="Myform" enctype="multipart/form-data" >
          <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-content">
                        <div class="form-group">
                        <input type="hidden" name="id" value="{$v.id}" />
                            <label class="col-sm-2 control-label">{:lang('名称')}</label>
                            <div class="col-sm-10">
                                <input id="name" name="name" class="form-control" required="required" placeholder="{:lang('输入')}{:lang('代理商名称')}" type="text" value="{$v.name}">
                            </div>
                        </div>
                         <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label" >{:lang('联系人')}</label>
                            <div class="col-sm-10">
                                <input id="contacts" name="contacts" required="required" class="form-control" placeholder="{:lang('输入')}{:lang('联系人姓名')}" type="text" value="{$v.contacts}">
                            </div>
                        </div>
                         <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label" >{:lang('联系电话')}</label>
                            <div class="col-sm-10">
                                <input id="mobile" name="mobile" placeholder="{:lang('输入')}{:lang('联系电话')}" required="required" class="form-control" type="text" value="{$v.mobile}">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div> 
                        <div class="form-group">
                            <label class="col-sm-2 control-label">{:lang('企业标识')}</label>
                            <div class="col-sm-10">
                                <input id="identifying" name="identifying" placeholder="{:lang('请设置初始企业标识（只能输入英文）')}" required="required" class="form-control" type="text" value="{$v.identifying}">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                           
                    </div>
                </div>
            </div>     
        </div>
        <div class="row"  style="margin-top: 23px;">
            <div class="center-block col-sm-2">
                <button type="button" class="btn btn-primary btn-block" id="submit">{:lang('提交')} </button>
            </div>      
        </div>
        </form>
    </div>
    <script src="{$Think.config.site.resource_url}js/jquery.min.js?v=2.1.4"></script>
    <script src="{$Think.config.site.resource_url}js/bootstrap.min.js?v=3.3.5"></script>
    <script src="{$Think.config.site.resource_url}js/content.min.js?v=1.0.0"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/validate/jquery.validate.min.js"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/validate/messages_zh.min.js"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/layer/layer.js"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/sweetalert/sweetalert.min.js"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/layer/laydate/laydate.js"></script>
  <script type="text/javascript">
  $(function(){
    $('#times').change(function(){
        var num = $('#times').val();
        if(num==0){
            $('#endtime').html();
         }
        var time = '<?php echo $v['expiration_date']; ?>';
         $.ajax({
          async: false,
          url:'<?php echo \think\Request::instance()->root(); ?>/ausadmin/Operator/times?id='+num+'&t='+time,
          type:'GET',
          dataType:"json",
          success: function(data){
              $('#endtime').html(data);
          },

        });

         
    });
    //更新信息
    $("#submit").click(function(){
        var name = $('#name').val();
        var contacts = $('#contacts').val();
        var mobile = $('#mobile').val();
        var username = $('#username').val();
        var identifying = $('#identifying').val();
        var password = $('#password').val();
        var time = $('#times').val();
        var version = $('#version').val();
        if(name==''){
            $('#name').focus();
            return false;
        }
        if(contacts==''){
            $('#contacts').focus();
            return false;
        }
        if(mobile==''){
            $('#mobile').focus();
            return false;
        }
        if(username==''){
            $('#username').focus();
            return false;
        }
        if(identifying==''){
            $('#identifying').focus();
            return false;
        }
        if(password==''){
            $('#password').focus();
            return false;
        }
        if(version==''){
            $('#version_chosen').focus();
            return false;
        }
        var formdata = $('#Myform').serialize(); 
        $.ajax({
            type : 'POST',
            url  : '<?php echo \think\Request::instance()->root(); ?>/ausadmin/Operator/edit',
            dataType : 'json',
            data : formdata,
            async : false,
            success : function(result){
                if(0 == result.code){
                    layer.msg(result.msg, {icon: 1});
                    parent.location.reload();
                }else{
                    layer.msg(result.msg, {icon: 5});
                }
            },
            error : function(){
                layer.msg("{:lang('服务器错误！请稍后重试')}", {icon: 2});
            }
        })
        return true;
  });
});
  </script>

</body>

</html>